package com.example.progressrecord.utils

import android.util.Log
import java.util.*

class DateTimeUtils private constructor() {

    private val calendar by lazy { Calendar.getInstance() }

    companion object {
        private val instance by lazy { DateTimeUtils() }
        fun instance(): DateTimeUtils {
            Log.wtf("DateTimeUtils.singleton", instance.toString())
            return instance
        }
    }

    fun getHourNow() = calendar.get(Calendar.HOUR_OF_DAY)
    fun getMinuteNow() = calendar.get(Calendar.MINUTE)
    fun getYearNow() = calendar.get(Calendar.YEAR)
    fun getMonthNow() = calendar.get(Calendar.MONTH)
    fun getDayNow() = calendar.get(Calendar.DAY_OF_MONTH)

    fun getTimeStr() = "${getHourNow()}:${getMinuteNow()}"
}